function http(url,callback,type){ //callback = handleData
    wx.request({
        url,
        header: {
            'Content-Type': 'json'
        },
        success: function(res) {
            callback(res,type);
        }
    });
}
function star(stars){
    var value = stars.slice(0,1);
    var arr = [];
    for(let i=0;i < 5;i++){
        if(i < value){
            arr.push(1);
        }else{
            arr.push(0);
        }
    }
    return arr;
}
function sliceTitle(title){
    if(title.length>6){
        title = title.slice(0,6)+"...";
    }
    return title;
}
function handleCasts(casts){ //演员
    var arr = [];
    casts.forEach(ele=>{
        arr.push(ele.name);
    })
    var newArr =arr.join("/");
    return newArr;
}
function handleGenres(genres){  //电影类型
    var genres =genres.join("、");
    return genres;
}
export default{
    http,
    star,
    sliceTitle,
    handleCasts,
    handleGenres
}
